﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;

namespace UI.Forms
{
    public partial class bank_U : FormBase1
    {
        public delegate void DoAction();//如果有参数的话，定义参数 

        public DoAction FatherRefresh;
        int count = 0;
        private SVC.client.bank _b;
        public bank_U(SVC.client.bank b)
        {
            InitializeComponent();
            _b = b;
        }

        private void btn_OK_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (!dvp.Validate()) return;
           
            _b.name = textEdit1.Text.Trim();
            
            string r = my.bw.bank_Update(_b, my.ACID);
            if (!string.IsNullOrEmpty(r))
            {
                Comm.ShowErorr(r);
            }
            else
            {
                Comm.ShowInfo("修改现金银行帐号成功！");
                count++;
                textEdit1.Text = "";

            }
        }

        private void add_bank_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (count>0)
            {
                FatherRefresh();
            }
        }

        private void bank_U_Load(object sender, EventArgs e)
        {
            textEdit1.Text = _b.name;

        }
    }
}